Skip to content

Add ElementCSSInlineStyle and CSSStyleDeclaration #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2020

Conversation

singpolyma
Copy link
Contributor

Both needed so one can use el.style for dynamically styling DOM Element.

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks great aside from one minor thing with the coercion here.


foreign import style :: ElementCSSInlineStyle -> Effect CSSStyleDeclaration

fromElement :: Element -> ElementCSSInlineStyle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fromHTMLElement and using Web.HTML.HTMLElement (HTMLElement) since the spec IDL just has:

HTMLElement implements ElementCSSInlineStyle;
SVGElement implements ElementCSSInlineStyle;

(No need to worry about the SVG case just now, there isn't a web-svg library).

Element is the parent interface so both of these, but also applies to XML documents I think, where this wouldn't apply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This is a mixin for HTMLElement and others from CSSOM to add the style attribute.
Adds all needed methods.  There are also named properties for every CSS
property, but those are redundant with getPropertyValue / setProperty.
@garyb
Copy link
Member

garyb commented Sep 27, 2020

Thanks!

@garyb garyb merged commit ae2ff8a into purescript-web:master Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants